---
title: Search bills and open a result
summary: A user searches bills by criteria, reads the result grid and opens a bill on the Bill entry screen.
status: draft
owner: Claims
last_reviewed: 2026-09-30
operation_id: search-and-open-bill
trigger: User submits criteria on the Search screen
---

# Search bills and open a result

A user searches bills by criteria, reads the result grid and opens a bill on the Bill entry screen.

## Trigger and screens

| Item | Detail |
| --- | --- |
| Trigger | User submits criteria on the Search screen |
| Screens | [Search](../../screens/search.md), [Bill entry](../../screens/entry.md) |
| Tables | Not traced** |

## Steps

1. The user opens the Search screen (`Search.Index`) and enters criteria.
   1. The action loads the bill type and bill status lists with `IBillEntryService.GetBillTypeCodes` and `GetBillStatusCodes`.
   2. It loads the "Search" grid preferences and pre-fills the claim number from the current web-context value.
2. The grid calls [Search.GetBills](../hosted-endpoints.md#search.getbills).
   1. A search runs only when a bill id, tax id, provider id, SSN, claim number or received date is given ([BR-SCR-013](../business-rules.md#br-scr-013-search-requires-qualifying-criteria)). Otherwise the action returns an empty result with the input-error message when `ApplyValidation` is set.
   2. The action builds a `BillEntrySearchCriteria` and calls `IBillQueryService.GetBillEntryBillsByCriteria`.
   3. The action maps the returned items to `SearchResultItemViewModel` rows with AutoMapper and returns the grid data with the secure, maximum-retrieved and no-results messages.

   > **Origin**: Steps 1.1 and 2.2 are the controller-side calls to `IBillEntryService` and `IBillQueryService` in `SAIF.SAIFCode.Core`†. Per the Legends CLI RAG service, `SAIF.SAIFCode.Core` is a contracts-only library and these interfaces' implementations live outside it (most likely `SAIF.Services`), which this run did not trace*.
3. Column layout is saved or cleared through [BaseController.SavePreferences](../hosted-endpoints.md#basecontroller.savepreferences) and [BaseController.ClearPreferences](../hosted-endpoints.md#basecontroller.clearpreferences). Both actions return nothing.
4. The user opens a result. The client allows only Pending, Entered, Audited or Suspended bills ([BR-SCR-001](../business-rules.md#br-scr-001-bills-must-be-in-an-openable-status)).
5. The browser navigates to `Entry/Index/{billId}` and the Bill entry screen loads it.
   1. `Entry.Index` loads the diagnosis and procedure type lists through `IBillDiagnosisService.GetDiagnosisTypeCodes` and `IBillProcedureService.GetPrimaryProcedureCodes`, and reads the queue count with `IBillEntryService.GetClaimBillQueueRemainingCount` and the bill type codes with `IBillEntryService.GetBillTypeCodes`.
   2. It sets `CanDiscardBill` from the `CBEDiscardBill` permission ([BR-SCR-006](../business-rules.md#br-scr-006-discard-permission-is-enforced-client-side-only)).
   3. The Bill entry screen calls [Entry.GetBill](../hosted-endpoints.md#entry.getbill), which calls `IBillEntryService.GetBill`. A bill that is not updateable is refused with "Only Pending, Entered, Audited, or Suspended bills may be opened." ([BR-SCR-001](../business-rules.md#br-scr-001-bills-must-be-in-an-openable-status)).
   4. The action calls `IClaimInformationService.GetClaimId` and `GetClaimSecurity`. For a conflict claim it requires the `ConflictClaim` permission ([BR-SCR-002](../business-rules.md#br-scr-002-conflict-claim-bills-require-conflictclaim-permission)).
   5. The action maps the bill to the entry view model with AutoMapper and adds the queue count, and the screen displays it.

   > **Origin**: Step 5 embeds steps 5–7 of [Open a bill from the inbox](open-bill-from-inbox.md), which documents this same controller-side sequence in full and is executed on behalf of this operation. Steps 5.1–5.4 are the controller-side calls to `IBillDiagnosisService`, `IBillProcedureService`, `IBillEntryService` and `IClaimInformationService` in `SAIF.SAIFCode.Core`† (`ClaimBillEntry/Controllers/EntryController.cs`); per the Legends CLI RAG service, `SAIF.SAIFCode.Core` is a contracts-only library and these interfaces' implementations live outside it (most likely `SAIF.Services`), which this run did not trace*. Step 5.5's mapping is confirmed in `ClaimBillEntry/Classes/AutoMapperBootStrapper.cs`.

## Process flow

The diagram shows the main path and its decision points.

```mermaid
flowchart TD
    A["Enter criteria"] --> B["Search.GetBills"]
    B --> C{"Qualifying criterion given?"}
    C -->|"No"| X["Input-error message"]
    C -->|"Yes"| D["Result grid"]
    D --> E{"Status openable?"}
    E -->|"No"| Y["Show status error"]
    E -->|"Yes"| F["Open Entry/Index/id"]
```

## Failure and edge-case behavior

- Status or type alone does not qualify, and the input-error message appears when validation is applied ([BR-SCR-013](../business-rules.md#br-scr-013-search-requires-qualifying-criteria)).
- Non-openable bills cannot be opened ([BR-SCR-001](../business-rules.md#br-scr-001-bills-must-be-in-an-openable-status)).

## Related documentation
- [Operations and processes](../operations-processes.md)
- [Business rules](../business-rules.md)
- [Hosted endpoints](../hosted-endpoints.md)
- [Data model](../data-model.md)
- [Architecture](../architecture.md)
- [Tech debt](../tech-debt.md)
- [Screen catalog](../../screens/index.md)

> **Note:** Statements marked with `†` are derived from dependency library
> documentation via the Legends CLI. Statements marked with `*` were inferred
> from code structure or contextual evidence. Statements marked with `**` could
> not be confirmed; treat as unknown until verified.

## Sources
- ClaimBillEntry/Controllers/SearchController.cs
- ClaimBillEntry/Controllers/BaseController.cs
- ClaimBillEntry/Controllers/EntryController.cs
- ClaimBillEntry/Classes/AutoMapperBootStrapper.cs
- ClaimBillEntry/js/ClaimBillEntry.search.js